#ifndef SerialUtil_H
#define SerialUtil_H
#include <QObject>
#include "../head/mBPSK_Demodulator/BPSK_Demodulator.h"
#include <QSerialPort>


QT_BEGIN_NAMESPACE
namespace Ui { class Widget; }
QT_END_NAMESPACE
#define     RECEIVE_BUF_SIZE             4100
#define     RECEIVE_BUF_SIZE_COUNT       20


class SerialUtil : public QObject
{
    Q_OBJECT
public:
    explicit SerialUtil(QString port,
                        QSerialPort::BaudRate baudRate,
                        QSerialPort::DataBits dataBits,
                        QSerialPort::StopBits stopBits,
                        QSerialPort::Parity checkBits,
                        QObject *parent = nullptr);
    void initParam();

public slots:   
    QString connectSerail();

protected:
    void run();

signals:
    void sendToDemoudle(QList<double> list1);
    void sendToWorkPlat(FIFO_Receiver fifoReceiver1);
private:
    FIFO_Receiver fifoReceiver1;
    QSerialPort *serialPort;
    double *p_mid_temp;
    int find_start_lable = 0;
    int temp = 0;
};

#endif // SerialUtil_H
